function res = y(x,p)
% Y - 
    [err,u,v,w]= check(x,p);
    res = 2/5;
    S = 0;
    for i =1:3,
        S = S+v(i)/(1+exp(w(i)*x-u(i)));
    end
    res = res +(x-1)*S;
end
function [err,u,v,w] = check(a,x)
% CHECK - 检测输入变量
%   
    err = 0; sx = size(x); n = max(sx);
    sa =size(a);
    if  (min(sx) ~= 1) |n~=9| ~isreal(x) | any(isnan(x(:))) | isinf(norm(x(:))) 
        err = -1; 
    end
    if  (min(sa) ~= 1) |(max(sa) ~= 1)| ~isreal(a) | any(isnan(a(:))) | isinf(norm(a(:))) 
        err = -1; 
    end
    if err == 0,
        u = x(1:3);
        v = x(4:6);
        w = x(7:9);
    end
end
